var enableInspectElement = 'false'; if (enableInspectElement == 'false') { $(document).bind("contextmenu",function(e) { e.preventDefault(); }); document.onkeydown = function (e) { if (event.keyCode == 123) { return false; } if (e.ctrlKey && e.shiftKey && (e.keyCode == 'I'.charCodeAt(0) || e.keyCode == 'i'.charCodeAt(0))) { return false; } if (e.ctrlKey && e.shiftKey && (e.keyCode == 'C'.charCodeAt(0) || e.keyCode == 'c'.charCodeAt(0))) { return false; } if (e.ctrlKey && e.shiftKey && (e.keyCode == 'J'.charCodeAt(0) || e.keyCode == 'j'.charCodeAt(0))) { return false; } if (e.ctrlKey && (e.keyCode == 'U'.charCodeAt(0) || e.keyCode == 'u'.charCodeAt(0))) { return false; } if (e.ctrlKey && (e.keyCode == 'S'.charCodeAt(0) || e.keyCode == 's'.charCodeAt(0))) { return false; } } } $(document).ready(function () { logMsg('SDDI Url : https://traffic.rta.ae/trfesrv'); logMsg('CSRF_TOKEN_NAME : CSRFfpsf8z'); logMsg('CSRF_TOKEN_VALUE : w3b49550a8az'); var start = new Date().getTime(); try { scanForms(); scanLinks(); scanIFrames(); scanImages(); var taskTrf75209Enabled = 'false'; if (taskTrf75209Enabled == 'false') { encryptLinks(); } } catch(err) { alert('Error applying CSRF security :' + err); logMsg('Error : ' + err); } var end = new Date().getTime(); window.console.log( 'CSRF scan took about : [' + ( end - start )/1000 + '] second' ); }); /** * Scan Links and encrypt it's href */ function encryptLinks() { var taskSLI13209Enabled = 'true'; if (taskSLI13209Enabled == 'false') { return; } var requestURI = window.location.pathname; var skippedCryptoURL = isSkippedRequest(requestURI); if (skippedCryptoURL == 'true') { return; } $("a").each(function() { var encryptedLink = encryptLinkParameters($(this).attr('href')); $(this).attr('href', encryptedLink); }); } /** * Checks if passed URL is skipped crypto URL or not * * @param requestURI * @returns {string} */ function isSkippedRequest(requestURI) { if (isEmpty(requestURI)) { return 'true'; } var result = 'false'; try { $.ajax( { type : 'GET', dataType : 'text', async : false, cache : true, url : appendCSRFTokenToURL('/trfesrv/urlCryptoLogServlet'), data : { 'value' : trim(requestURI), 'command' : 'isSkippedCryptoURL', 'isPublicAccess' : true }, success : function (response) { result = response; }, error : function (e) { return 'false'; } }); } catch (e) { console.log("Error while trying to check url =" + value + " is skipped crypto URL or not ,because of " + e); } return result; } /** * Scan dom tree for